﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using ShiziEntity.User;
using ShizirDAL.User;

namespace ShizirBLL.User
{
    /// <summary>
    /// 经纪人用户信息类
    /// </summary>
    public class UserAgentBiz
    {
        private UserAgentData uad = new UserAgentData();

        /// <summary>
        /// 保存经纪人注册信息
        /// </summary>
        /// <param name="obj">用户实体</param>
        /// <returns>操作结果</returns>
        public bool SaveAgentRegister(UserAgent obj, ref int userID)
        {
            bool isSuccess = false;
            //保存用户基类信息
            UserBaseBiz ubb = new UserBaseBiz();
            ubb.SaveUserBase(obj, ref userID);
            if (userID > 0)
            {
                //保存用户基本信息
                obj.UserID = userID;
                uad.SaveUserAgent(obj);
                //保存用户权限信息
                UserAgentConBiz acb = new UserAgentConBiz();
                UserAgentCon uac = new UserAgentCon();
                uac.UserID = userID;
                uac.UserName = obj.UserName;
                uac.CityName = obj.CityName;
                acb.SaveUserAgentCon(uac);
                isSuccess = true;
             }
            return isSuccess;
        }

        /// <summary>
        /// 获取用户信息实体
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>用户信息实体</returns>
        public UserAgent GetUserAgentEntity(int userID)
        {
            return uad.GetUserAgentEntity(userID);
        }
    }
}